
#include "IO.h"
#include "BSP_Config.h"


static uint8_t buzzerState;



static const IO_T Buzzer =
{
    (void*)BUZ_GP, BUZ_PIN
};

/**
    \brief      configure the GPIO ports
    \param[in]  none
    \param[out] none
    \retval     none
  */
static void BSP_Buzzer_IO_Init(void)
{
	IO_Init(&Buzzer, IO_Mode_OUT);
}



static void BSP_Buzzer_Off(void){
	IO_Set(&Buzzer, 0);
}

static void BSP_Buzzer_On(void){	
	IO_Set(&Buzzer, 1);
}


void BSP_Buzzer_Set(uint8_t state){
	if(state){
		BSP_Buzzer_On();
	}
	else{
		BSP_Buzzer_Off();
	}
	buzzerState = state;
}

uint8_t BSP_Buzzer_State(void){
	return buzzerState;
}

void BSP_Buzzer_Init(void)
{
	BSP_Buzzer_IO_Init();
	BSP_Buzzer_Set(0);
}
